﻿<%@ Page Title="" ValidateRequest="false" Language="C#" MasterPageFile="~/Admin/AdminMTP.Master" AutoEventWireup="true" CodeBehind="LetterManager.aspx.cs" Inherits="SQT.tracnghiem.Admin.LetterManager" %>

<%@ Import Namespace="DataAccess" %>
<%@ Import Namespace="System.Text" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Scripts/tinymce/tinymce.min.js"></script>
    <script src="../Scripts/tinymce/plugins/furigana/plugin.min.js"></script>
    <style>
        .notViewed {
            font-weight: bold;
        }

        .Viewed {
        }

        .search-email-input {
            width: 340px;
        }

        #reply-mail {
            float: right;
        }

        #letter-history {
            float: right;
        }

        .letter-list-table tbody tr {
            background-color: white;
        }

            .letter-list-table tbody tr td:last-child {
                text-align: center;
            }

        .letter-list-table thead tr th:last-child {
            text-align: center;
        }

        .letter-history {
            display: none;
            max-height: 377px;
            overflow: auto;
        }

        /*tutorial*/
        .overlay {
            height: 0%;
            width: 100%;
            position: fixed;
            z-index: 1;
            top: 0;
            left: 0;
            background-color: rgb(0,0,0);
            background-color: rgba(0,0,0, 0.9);
            overflow-y: hidden;
            transition: 0.5s;
        }

            .overlay .closebtn {
                position: absolute;
                top: 20px;
                right: 45px;
                font-size: 60px;
            }

        #ddl_speciesEmail {
            z-index: 100;
            position: relative;
        }

        .view-tutorial {
            background-color: white;
            color: black;
            z-index: 100;
            position: relative;
            height: 500px;
            width: 500px;
            position: absolute;
            margin-right: 300px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <%--<div id="myNav" class="overlay">
        <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
        <div class="overlay-content">
            
        </div>
    </div>
    <div class="view-tutorial">
                Đấy là chọn loại sản phẩm.
            </div>--%>
    <script>
        document.getElementById("myNav").style.height = "100%";
        function openNav() {
            document.getElementById("myNav").style.height = "100%";
        }

        function closeNav() {
            document.getElementById("myNav").style.height = "0%";
        }
    </script>

    <div id="main-admin" class="admin-df w3-row w3-light-grey">
        <header class="w3-padding w3-large w3-center w3-teal">HỘP THƯ</header>
        <div class="letter-option w3-row w3-padding w3-border-bottom w3-border-teal">
            <select id="ddl_speciesEmail" class="choose w3-teal">
                <option value="0" selected="selected">Chọn loại thư</option>
                <option value="1">Đăng ký mở lớp</option>
                <option value="2">Góp ý</option>
                <option value="3">Đăng ký nhận tin</option>
            </select>
            <select id="ddl_sendedEmail" class="choose w3-teal" id="sl_mail_type">
                <option value="0" selected="selected">Trạng thái</option>
                <option value="1">Chưa trả lời</option>
                <option value="2">Đã trả lời</option>
            </select>
            <select id="ddl_filterEmail" class="choose w3-teal">
                <option value="0" selected="selected">Sắp xếp theo</option>
                <option value="1">Ngày gửi</option>
                <option value="2">Họ tên</option>
                <option value="3">Email</option>
            </select>
            <div class="w3-right w3-quarter search-email-input">
                <span class="letter-search-btn w3-teal" title="Tìm kiếm"><i class="fa fa-search"></i></span>
                <input id="txt_searchEmail" type="text" placeholder="Tìm kiếm theo họ tên, email, SĐT" />
            </div>
        </div>
        <%--<%var get_letter = (from p in new TblContactController().FetchAll().Where(x => x.Viewed == false) orderby p.DateX descending select p); %>
    <div class="w3-responsive">
            <table id="letter_area" class="w3-table w3-small w3-striped w3-white w3-bordered">
                <tr class="w3-teal">
                    <th>Họ tên</th>
                    <th>Ngày sinh</th>
                    <th>Giới tính</th>
                    <th>Email</th>
                    <th>SĐT</th>
                    <th>Địa chỉ</th>
                    <th>Nghề nghiệp</th>
                    <th>Cách tiếp cận</th>
                    <th>Mục đích học</th>
                    <th>Trình độ</th>
                    <th>Lớp</th>
                    <th>Yêu cầu</th>
                    <th>Ngày gửi</th>
                    <th>Trả lời</th>
                </tr>
                <%foreach(TblContact contact in get_letter){
                      string date = DateTime.Parse(contact.DateX.ToString()).Day + "/" + DateTime.Parse(contact.DateX.ToString()).Month + "/" + DateTime.Parse(contact.DateX.ToString()).Year;
                      string sex = "Nam";
                      if (contact.Sex == false)
                          sex = "Nữ";
                      string birthday = DateTime.Parse(contact.Birthday.ToString()).Day + "/" + DateTime.Parse(contact.Birthday.ToString()).Month + "/" + DateTime.Parse(contact.Birthday.ToString()).Year;
                      %>
                <tr class="contact_<%=contact.Id %>">
                    <td><%=contact.FullName %></td>
                    <td><%=birthday %></td>
                    <td><%=sex %></td>
                    <td><%=contact.Email %></td>
                    <td><%=contact.Phone %></td>
                    <td><%=contact.Address %></td>
                    <td><%=contact.Job %></td>
                    <td><%=contact.Traditional %></td>
                    <td><%=contact.Purpose %></td>
                    <td><%=contact.Degree %></td>
                    <td><%=contact.ClassX %></td>
                    <td><%=contact.Request %></td>
                    <td><%=date %></td>
                    <td class="checkbox"><input type="checkbox" id="answer-mail<%=contact.Id %>" /><label for="answer-mail<%=contact.Id %>"></label></td>
                </tr>
                <%} %>
            </table>--%>
        <div class="w3-row">
            <div class="letter-left w3-col l6 w3-border-right w3-border-teal">
                <header class="w3-center w3-padding w3-teal">
                    <label id="lbl_countKOM"></label>
                    &nbsp;<label id="lbl_countValue"></label>
                </header>
                <div class="letter-list" id="get_email_contact">
                </div>
            </div>
            <div class="letter-right w3-col l6 w3-animate-right">
                <header class="w3-center w3-padding w3-teal">
                    <label>Chi tiết thư</label>
                </header>
                <div class="letter-detail w3-white" id="email_info_contact">
                </div>
                <div class="w3-row w3-padding w3-teal">
                    <a onclick="return_view(this)" id="return-view" class="w3-btn w3-teal w3-border w3-border-white w3-hover-white w3-hover-text-teal"><i class="fa fa-eye-slash"></i>&nbsp;<span>Chưa xem</span></a>
                    <a onclick="reply_mail(this)" id="reply-mail" class="w3-btn w3-teal w3-border w3-border-white w3-hover-white w3-hover-text-teal"><i class="fa fa-chevron-circle-up"></i>&nbsp;<span>Trả lời</span></a>
                    <a onclick="send_mail()" class="letter-send-btn w3-btn w3-teal w3-border w3-border-white w3-hover-white w3-hover-text-teal"><span>Gửi</span>&nbsp;<i class="fa fa-send"></i></a>
                    <a onclick="history_mail(this)" id="letter-history" class="w3-btn w3-teal w3-border w3-border-white w3-hover-white w3-hover-text-teal"><i class="fa fa-history"></i>&nbsp;<span>Lịch sử</span></a>
                </div>
                <div class="letter-detail-row letter-answer w3-row w3-white w3-animate-bottom">
                    <label class="w3-col l4">Trả lời:</label><br />
                    <textarea id="letter-answer" class="w3-col l8"></textarea>
                </div>
                <div id="letter-history-view" class="letter-detail-row letter-history w3-row w3-white w3-animate-bottom">
                    <label class="w3-col l4">Lịch sử:</label><br />
                </div>
            </div>
            <div id="success-modal" class="w3-row w3-animate-right" style="position: fixed; right: 50px; bottom: 1%; z-index: 10; display: none">
                <div class="w3-teal w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
                    <header class="w3-large"><i class="fa fa-check"></i>&nbsp;<span class="success_content"></span></header>
                </div>
            </div>
            <div id="error-modal" class="w3-row w3-animate-right" style="position: fixed; right: 50px; bottom: 1%; z-index: 10; display: none">
                <div class="w3-card-4 w3-center w3-red" style="padding: 20px; opacity: 0.9">
                    <header class="w3-large"><i class="fa fa-check"></i>&nbsp;<span class="error_content"></span></header>
                </div>
            </div>
            <div id="return-view-success-modal" class="w3-row w3-animate-right" style="position: fixed; right: 50px; bottom: 1%; z-index: 10; display: none">
                <div class="w3-teal w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
                    <header class="w3-large"><i class="fa fa-eye-slash"></i>&nbsp;<span class="rview_content"></span></header>
                </div>
            </div>
        </div>
    </div>

    <script src="../Scripts/letter.js"></script>
</asp:Content>